function mySetInterval(fn, time) {
    function wrapFn(...args) {
        setTimeout(wrapFn, time)
        fn.call(this, ...args)
    }
    setTimeout(wrapFn, time)
}

mySetInterval(() => { console.log(1) }, 2 * 1000)